<link rel="stylesheet" type="text/css" href="assets/bootstrap-datepicker/css/datepicker.css" />
<section id="main-content">
	<section class="wrapper">
		<!--state overview start-->
		<div class="row first">
			<div class="col-lg-12">
				<!-- <div class="view-header">
					<div class="view-search">
						<label class="pull-left">提交日期：</label>
						<input id="datetime-star" type="text" value="" class="form-control pull-left">
						<label class="pull-left">至&nbsp;&nbsp;</label>
						<input id="datetime-2" type="text" value="" class="form-control pull-left">

						<a href="javascript:void(0);" class="btn btn-info pull-left searchs">查询</a>
					</div>
				</div> -->

				<section class="panel">
					<div class="panel-body" style="padding-bottom:0;">
						<div class="row">
							<div class="col-lg-3">
								<div class="input-group m-bot15">
									<span class="input-group-addon">开始日期</span>
									<input type="text" id="datetime-starj" class="form-control" placeholder="开始日期">
								</div>
							</div>
							<div class="col-lg-3">
								<div class="input-group m-bot15">
									<span class="input-group-addon">结束日期</span>
									<input type="text" id="datetime-2j" class="form-control" placeholder="结束日期">
								</div>
							</div>
							<div class="col-lg-3">
								<button style="margin-bottom:15px" class="btn btn-info searchs">查询</button>
							</div>
						</div>
					</div>
				</section>

				<section class="panel">
					<header class="panel-heading">
						项目进展
					</header>
					<div class="panel-body">
						<div id="msgContainer1j" class="dlshouwen-grid-container"></div>
						<div id="msgToolBarContainer1j" class="dlshouwen-grid-toolbar-container"></div>
					</div>
				</section>

				<section class="panel">
					<header class="panel-heading">
						OKR子任务进展
					</header>
					<div class="panel-body">
						<div id="msgContainer3j" class="dlshouwen-grid-container"></div>
						<div id="msgToolBarContainer3j" class="dlshouwen-grid-toolbar-container"></div>
					</div>
				</section>
			</div>
		</div>
		<!--state overview end-->
	</section>
</section>
<script type="text/javascript" src="assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<!-- 当前页面js文件引入 -->
<script>
	$('#datetime-starj').datepicker({
		format: 'yyyy-mm-dd'
	});
	$("#datetime-2j").datepicker({
		format: 'yyyy-mm-dd'
	});

    //n为你要传入的参数，当前天为0，前一天为-1，后一天为1
    function getBeforeDate(n) {
        var date = new Date();
        var year, month, day;
        date.setDate(date.getDate() + n);
        year = date.getFullYear();
        month = date.getMonth() + 1;
        day = date.getDate();
        s = year + '-' + (month < 10 ? ('0' + month) : month) + '-' + (day < 10 ? ('0' + day) : day);
        return s;
    }

    $("#datetime-starj").val(getBeforeDate(-13));
    $("#datetime-2j").val(getBeforeDate(0));

	function findJztzs(CertusFormAjax, CertusJsonAjax) {
		//项目进展
		var msgColumns2 = [{
			id: 'pro_name',
			title: '项目名称',
			type: 'string',
			width: 150,
			columnClass: 'text-center'
		}, {
			id: 'content',
			title: '项目进展',
			type: 'string',
			width: 250,
			columnClass: 'text-left',
		}, {
			id: 'next_step',
			title: '下一步计划',
			type: 'string',
			columnClass: 'text-left',
		}, {
			id: 'user_name',
			title: '提交人',
			type: 'string',
			width: 75,
			columnClass: 'text-center',
		}, {
			id: 'code',
			title: '详细状态',
			type: 'string',
			width: 100,
			columnClass: 'text-center',
			resolution: function (value) {
				var psg = "";
				if (value == 1) {
					psg = "线索申请待审批";
				} else if (value == 2) {
					psg = "线索审批中";
				} else if (value == 3) {
					psg = "线索审批通过";
				} else if (value == 4) {
					psg = "线索审批不通过";
				} else if (value == 5) {
					psg = "项目立项待审批";
				} else if (value == 6) {
					psg = "立项审批中";
				} else if (value == 7) {
					psg = "立项审批通过";
				} else if (value == 8) {
					psg = "立项审批不通过";
				} else if (value == 9) {
					psg = "立项审批通过待商务预测";
				} else if (value == 10) {
					psg = "立项通过";
				} else if (value == 11) {
					psg = "发起投标待审批";
				} else if (value == 12) {
					psg = "投标审批中";
				} else if (value == 13) {
					psg = "投标审批通过";
				} else if (value == 14) {
					psg = "投标审批不通过";
				} else if (value == 15) {
					psg = "合同上传申请待审批";
				} else if (value == 16) {
					psg = "合同审批中";
				} else if (value == 17) {
					psg = "合同审批通过";
				} else if (value == 18) {
					psg = "合同审批不通过";
				} else if (value == 19) {
					psg = "验收结果上传";
				} else if (value == 20) {
					psg = "项目结束";
				}
				return psg;
			}
		}
			, {
			id: 'pro_lv',
			title: '优先级',
			type: 'string',
			width: 60,
			columnClass: 'text-center',
			resolution: function (value) {
				var content = '';
				if (value == 1) {
					content += '低';
				}
				if (value == 2) {
					content += '中';
				}
				if (value == 3) {
					content += '高';
				}
				return content;
			}
		}, {
			id: 'begin_time',
			title: '周期',
			type: 'date',
			format: 'yyyy-MM-dd',
			width: 200,
			otype: 'time_stamp_ms',
			columnClass: 'text-center',
			resolution: function (value, record) {
				var date1 = new Date(record.begin_time);
				var content = $.fn.dlshouwen.grid.tools.dateFormat(date1, "yyyy/MM/dd");
				var date2 = new Date(record.end_time);
				content += "至" + $.fn.dlshouwen.grid.tools.dateFormat(date2, "yyyy/MM/dd");
				return content;
			}
		}, {
			id: 'create_time',
			title: '提交时间',
			type: 'date',
			width: 100,
			format: 'yyyy-MM-dd',
			otype: 'time_stamp_ms',
			columnClass: 'text-center',
		}, {
			id: 'operation',
			title: '操作',
			width: 60,
			type: 'string',
			columnClass: 'text-center',
			resolution: function (value, record, column, grid, dataNo, columnNo) {
				var content = '';
				content += '<button class="btn btn-xs btn-success" onclick="todpxmjz(' + record.id + ');"><i class="fa fa-edit"></i>  点评</button>';
				return content;
			}
		}
		];
		//项目进展
		var msgColumns1 = [{
			id: 'pro_name',
			title: '项目名称',
			type: 'string',
			width: 150,
			columnClass: 'text-center',
		}, {
			id: 'krs_desc',
			title: '关键成果',
			type: 'string',
			width: 250,
			columnClass: 'text-left',
		}, {
			id: 'rw_desc',
			title: '进展和困难',
			type: 'string',
			width: 250,
			columnClass: 'text-left',
		}, {
			id: 'next_plan',
			title: '下一步计划',
			type: 'string',
			columnClass: 'text-left'
		}, {
			id: 'user_name',
			title: '负责人',
			type: 'string',
			width: 75,
			columnClass: 'text-center'
		}, {
			id: 'finish_cycle',
			title: '进展周期',
			type: 'string',
			width: 130,
			columnClass: 'text-center'
		}, {
			id: 'update_time',
			title: '更新时间',
			type: 'date',
			width: 100,
			format: 'yyyy-MM-dd',
			otype: 'time_stamp_ms',
			columnClass: 'text-center'
		}, {
			id: 'operation',
			title: '操作',
			width: 60,
			type: 'string',
			columnClass: 'text-center',
			resolution: function (value, record, column, grid, dataNo, columnNo) {
				var content = '';
				content += '<button class="btn btn-xs btn-success" onclick="todp(' + record.id + ');"><i class="fa fa-edit"></i>  点评</button>';
				return content;
			}
		}];
		$(".searchs").click(function () {
			var startTime = $("#datetime-starj").val();
			var endTime = $("#datetime-2j").val();
			$("#msgContainer1j").empty();
			$("#msgToolBarContainer1j").empty();
			CertusJsonAjax.dataInit("findXmTzjzs", {
				"startTime": startTime,
				"endTime": endTime
			}, msgColumns2, 'msgContainer1j', 'msgToolBarContainer1j', 20, [20, 30, 40, 50]);

			//-----------------------
			$("#msgContainer3j").empty();
			$("#msgToolBarContainer3j").empty();
			CertusJsonAjax.dataInit("findOkrJztzs", {
				"startTime": startTime,
				"endTime": endTime
			}, msgColumns1, 'msgContainer3j', 'msgToolBarContainer3j');
		});
		$(".searchs").click();
	}

	function todpxmjz(rid) {
		location.href = "#/toProJzdp/" + rid;
	}

	function todp(pid) {
		location.href = "#/toOkrJzdp/" + pid;
	}
</script>